#ifndef _VAR_H_
#define _VAR_H_
#include<stddef.h>
#include"common.h"
typedef unsigned short __uint16_t;
enum{
    var_sign = 0,
    var_value,
    var_assigned,
};

typedef struct _variable
{
    __uint16_t name;
    union{
        __uint16_t flag;
        struct{
            __uint16_t sign       : 1;
            __uint16_t value      : 1;
            __uint16_t assigned   : 1;
            __uint16_t skip       : 1;  
            __uint16_t reserved   : 12;
        };
    };
}variable;
#define MASK_INIT_POSITIVE  (1 << 15)
#define MASK_INIT_NEGATIVE  (0)
#define copy_var(dest, src) (dest)->flag = (src)->flag; (dest)->name = (src)->name;

#define get_vflag(v, flag)  ((*v).flag)
#define set_vflag(v, flag, value) ((*v).flag = value)
static inline void set_vname(variable* var, unsigned int name){
    var->name = name;
}

static inline unsigned int get_vname(variable* var){
    return var->name;
}

static inline int get_real_value(variable* v){
    return get_vflag(v, sign) ? get_vflag(v, value) : (!get_vflag(v, value));
}



#endif